package lab02.test13;

import java.util.Scanner;

/**
 * Created by 123 on 2017/10/20.
 */
public class Gymnastics extends ComputerAverage {
    @Override
    double average(double[] scores) {
        double average;
        double highGrade = 0;
        double lowGrade = 101;
        double[] scorce = scores;


        for (int i = 0; i < 5; i++) {
            highGrade = (highGrade > scorce[i]) ? highGrade : scorce[i];//求最高成绩
        }
        System.out.println("最高成绩+" + highGrade);


        for (int i = 0; i < 5; i++) {

            lowGrade = (lowGrade < scorce[i]) ? lowGrade : scorce[i];//求最低成绩
        }
        System.out.println("最低成绩" + lowGrade);


        average = (scorce[0] + scorce[1] + scorce[2] + scorce[3] + scorce[4] - highGrade - lowGrade) / 3;


        return average;
    }
}
